package com.learn.redis.test;

import org.junit.Before;
import org.junit.Test;
import redis.clients.jedis.Jedis;

/**
 * @author DYZ
 * @date 2021/8/25
 */
public class RedisTestZSet {

    Jedis jedis;

    @Before
    public void setUp() {
        jedis = new Jedis("192.168.2.23", 6379);
    }

    @Test
    public void ping() {
        // 添加
        jedis.zadd("LearnScore", 10d, "Java");
        jedis.zadd("LearnScore", 20d, "Redis");
        jedis.zadd("LearnScore", 30d, "Jedis");
        jedis.zadd("LearnScore", 40d, "Spring");

        // 获取
        System.out.println(jedis.zrandmember("LearnScore"));

        // 获取
        System.out.println(jedis.zrange("LearnScore", 0, -1));
    }

}
//Java
//[Java, Redis, Jedis, Spring]